diff --git a/mod/questionnaire/lang/en/questionnaire.php b/mod/questionnaire/lang/en/questionnaire.php index 1a7c0ec..85d3578 100644 --- a/mod/questionnaire/lang/en/questionnaire.php +++ b/mod/questionnaire/lang/en/questionnaire.php @@ -111,8 +111,8 @@ value to its default **0** value. If you set **Min.** or **Max.** to values othe respondent does not comply with your requirements. Obviously you should make any requirements clear to the respondent either in the general instructions of your Questionnaire or in the text of relevant questions.'; $string['misconfigured'] = 'Course is misconfigured'; -$string['missingquestion'] = 'You are missing required question '; -$string['missingquestions'] = 'You are missing required questions: '; +$string['missingquestion'] = 'Error, please anser question '; +$string['missingquestions'] = 'Error, please answer questions: '; $string['modulename'] = 'Questionnaire'; $string['modulenameplural'] = 'Questionnaires'; $string['move'] = 'Move this question'; @@ -151,6 +151,7 @@ $string['of'] = 'of'; $string['opendate'] = 'Use Open Date'; $string['opendate_help'] = 'You can specify a date to open the questionnaire here. Check the check box, and select the date and time you want. Users will not be able to fill out the questionnaire before that date. If this is not selected, it will be open immediately.'; +$string['option'] = 'option {$a}'; $string['optionalname'] = 'Question Name'; $string['optionalname_help'] = 'The Question Name is only used when you export responses to CSV/Excel format. If you never export to CSV, then you needn\'t worry about Question names at all. diff --git a/mod/questionnaire/questiontypes/questiontypes.class.php b/mod/questionnaire/questiontypes/questiontypes.class.php index eaec677..b7e5b82 100644 --- a/mod/questionnaire/questiontypes/questiontypes.class.php +++ b/mod/questionnaire/questiontypes/questiontypes.class.php @@ -810,38 +810,43 @@ class questionnaire_question { if ($this->type_id == QUESSECTIONTEXT) { return; } - echo ' -
-
- - - - - - - - -
'; - if ($this->required == 'y') { - echo ''.get_string('required', 'questionnaire').''; - } - echo $qnum.' - '. - format_text(file_rewrite_pluginfile_urls($this->content, 'pluginfile.php', $this->context->id, - 'mod_questionnaire', 'question', $this->id), FORMAT_HTML).' -
- '; + echo html_writer::start_tag('fieldset', array('class' => 'qn-container')); + echo html_writer::start_tag('legend', array('class' => 'qn-legend')); + echo html_writer::start_tag('div', array('class' => 'qn-number')); + if ($this->required == 'y') { + echo html_writer::empty_tag('img', + array('class' => 'req', + 'title' => get_string('required', 'questionnaire'), + 'alt' => get_string('required', 'questionnaire'), + 'src' => $OUTPUT->pix_url('req'))); + } + echo $qnum; + echo html_writer::end_tag('div'); + echo html_writer::start_tag('div', array('class' => 'qn-question')); + if ($this->type_id == QUESNUMERIC || $this->type_id == QUESTEXT || + $this->type_id == QUESDROP) { + echo html_writer::start_tag('label', array('for' => $this->type . $this->id)); + } + if ($this->type_id == QUESESSAY) { + echo html_writer::start_tag('label', array('for' => 'edit-q' . $this->id)); + } + echo format_text(file_rewrite_pluginfile_urls($this->content, 'pluginfile.php', + $this->context->id, 'mod_questionnaire', 'question', $this->id), FORMAT_HTML); + if ($this->type_id == QUESNUMERIC || $this->type_id == QUESTEXT || + $this->type_id == QUESESSAY || $this->type_id == QUESDROP) { + echo html_writer::end_tag('label'); + } + echo html_writer::end_tag('div'); + echo html_writer::end_tag('legend'); + echo html_writer::start_tag('div', array('class' => 'qn-type')); } function questionend_survey_display() { if ($this->type_id == QUESSECTIONTEXT) { return; } - echo ' -
-
-
- '; + echo html_writer::end_tag('div'); + echo html_writer::end_tag('fieldset'); } function response_check_required ($data) { // JR check all question types if ($this->type_id == 8) { // Rate is a special case @@ -915,7 +920,8 @@ class questionnaire_question { function text_survey_display($data) { // Text Box echo 'precise > 0 ? ' maxlength="'.$this->precise.'"' : '').' value="'. - (isset($data->{'q'.$this->id}) ? stripslashes($data->{'q'.$this->id}) : '').'" />'; + (isset($data->{'q'.$this->id}) ? stripslashes($data->{'q'.$this->id}) : ''). + '" id="' . $this->type . $this->id . '" />'; } function essay_survey_display($data) { // Essay @@ -1156,7 +1162,9 @@ class questionnaire_question { } $options[$id] = $choice->content; } - echo html_writer::select($options, 'q'.$this->id, (isset($data->{'q'.$this->id})?$data->{'q'.$this->id}:'')); + echo html_writer::select($options, 'q'.$this->id, + (isset($data->{'q'.$this->id})?$data->{'q'.$this->id}:''), + array(''=>'choosedots'), array('id' => $this->type . $this->id)); } function rate_survey_display($data) { // Rate @@ -1261,7 +1269,10 @@ class questionnaire_question { for ($j = 0; $j < $this->length; $j++) { $checked = ((isset($data->$str) && ($j == $data->$str)) ? ' checked="checked"' : ''); echo ''; - echo ''; + $i = $j+1; + echo html_writer::tag('span', get_string('option', 'questionnaire', $i), + array('class' => 'accesshide')); + echo ''; if ($bg == 'qntype c0') { $bg = 'qntype c1'; } else { @@ -1296,7 +1307,9 @@ class questionnaire_question { function date_survey_display($data) { // Date - $date_mess = ' '.get_string('dateformatting', 'questionnaire'); + $date_mess = html_writer::start_tag('div', array('class' => 'qn-datemsg')); + $date_mess .= get_string('dateformatting', 'questionnaire'); + $date_mess .= html_writer::end_tag('div'); if (!empty($data->{'q'.$this->id})) { $dateentered = $data->{'q'.$this->id}; $setdate = check_date ($dateentered, false); @@ -1310,9 +1323,11 @@ class questionnaire_question { $data->{'q'.$this->id} = $setdate; } } + echo $date_mess; + echo html_writer::start_tag('div', array('class' => 'qn-date')); echo ''; - echo $date_mess; + echo html_writer::end_tag('div'); } function numeric_survey_display($data) { // Numeric @@ -1351,7 +1366,8 @@ class questionnaire_question { } echo ''; + '" value="'.(isset($data->{'q'.$this->id}) ? $data->{'q'.$this->id} : ''). + '" id="' . $this->type . $this->id . '" />'; } function sectiontext_survey_display($data) { diff --git a/mod/questionnaire/styles.css b/mod/questionnaire/styles.css index 23e71d9..1eaed0e 100644 --- a/mod/questionnaire/styles.css +++ b/mod/questionnaire/styles.css @@ -242,4 +242,21 @@ body#page-mod-questionnaire-myreport .generaltable { .floatprinticon { margin-top:-30px; float:right; -} \ No newline at end of file +} + +/* new styles - keep old (quOuter, qnInner, qnInnerTable, qnType) for sections etc. */ +#page-mod-questionnaire-view .qn-number { + float: left; +} +#page-mod-questionnaire-view .qn-question { + margin-left: 35px; + padding-left: 5px; + padding-bottom: 2px; + border-left: #CCCCCC thin dotted; +} +#page-mod-questionnaire-view .qn-type { + margin-left: 35px; + padding: 5px; + border-left: #CCCCCC thin dotted; + border-bottom: #CCCCCC thin dotted; +}